<?php

namespace app\controllers;

use Yii;
use app\models\User;
use app\models\UserSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;

/**
 * UserController implements the CRUD actions for User model.
 */
class CController extends Controller
{
	public function beforeAction($action){
        Yii::info("VH: beforeAction: " . Yii::$app -> request -> url);

        if(Yii::$app -> request -> url != "/user/login"){
            if(Yii::$app -> getSession() -> get("user") == null){
                Yii::$app -> controller -> redirect("/user/login");
                return false;
            }
        }

        if (parent::beforeAction($action)) {
            // your custom code here
            Yii::info("VH: beforeAction true");

            return true;  // or false if needed
        } else {

            Yii::info("VH: beforeAction false");
            return false;
        }
    }
}
